<?php
/**
 *
 * @version
 * @author duongthienduc
 **/

class Bet_Form_News_Article extends Zend_Form {

	public function init()
	{
		$this->setMethod('post')
			->addPrefixPath('Bet_Form_Element', 'Bet/Form/Element/', Zend_Form::ELEMENT)
			->addElement(
	            'text', 'title', array(
	                'label' => 'Title:',
	                'required' => true,
	                'filters'    => array('StringTrim'),
	                'size' => 80,
			));

		$newsCatMapper = new Bet_Model_NewsCategoryMapper();
		$newsCats = $newsCatMapper->fetchAllArray();
		$options = array();
		foreach ($newsCats as $newsCat) {
			$options[$newsCat['news_category_id']] = $newsCat['title'];
		}

		$this->addElement('select', 'newsCategoryId', array(
	            'label' => 'Category:',
	            'required' => true,
                'filters'    => array('Digits'),
				'multiOptions' => $options
			));

		$text = new Bet_Form_Element_TinyMce('text');
		$text->setAttrib("class", "tinymce")
			->setLabel('Text:')
			->setAttrib('required', true);
		$this->addElement($text)
			->addElement('submit', 'submit', array('ignore'   => true, 'label'    => 'Save', ))
			->addElement('hidden', 'cid');
	}

}
?>